package com.foryou.system.modules.wx;

import com.foryou.system.modules.wx.enums.CodeEnum;

public class EnumUtil {

    /** 通过code获取枚举 */
    public static <T extends CodeEnum> T getEnumByCode(String code, Class<T> enumClass) {
        for (T each : enumClass.getEnumConstants()) {
            if(code.equals(each.getCode())){
                return  each;
            }
        }
        return null;
    }
}
